package com.itheima;

import com.itheima.service.UserService;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Demo1 {

    private ApplicationContext ctx;

    @Before
    public  void init(){
        ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
    }

    @Test
    public void test(){
        UserService userService2 = ctx.getBean("userService2", UserService.class);

        System.out.println(userService2);
    }

    @Test
    public void test1(){
        UserService userService3 = ctx.getBean("userService3", UserService.class);
        System.out.println(userService3);
    }

    @Test
    public void test2(){
        UserService userService3 = ctx.getBean("userService4", UserService.class);
        System.out.println(userService3);
    }
    @Test
    public void test3(){
        UserService userService3 = ctx.getBean("userService5", UserService.class);
        System.out.println(userService3);
    }
    @Test
    public void test4(){
        UserService userService3 = ctx.getBean("userService6", UserService.class);
        System.out.println(userService3);
    }
}
